<?php
//当前控制器的命名空间，对应Application/Home/Contriller
namespace Admin\Model;
//引用的命名空间，对应ThinkPHP/Library/Think目录

use Think\Model;
class AdminModel extends Model {
//关联定义
    public function checkLogin() {
        $username = $this -> data['username'];
        $password = $this -> data['password'];
        $data = $this -> field('password,salt') -> where(array('username' => $username)) ->find();
        if($data) {
            return $data['password'] == $this -> password($password,$data['$salt']);
        }
        return false;
    }
   
    private function password($password, $salt) {
        return md5(md5($password).$salt);
    }
}